<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('invoices', function (Blueprint $table) {
            $table->id();
            $table->string('invoice_number')->unique();
            $table->date('invoice_date')->comment('开票日期');
            $table->unsignedBigInteger('total_amount')->default(0)->comment('发票金额');
            $table->string('title')->comment('抬头');
            $table->string('department')->comment('开票单位');
            $table->unsignedBigInteger('order_id')->comment('订单id');
            $table->unsignedTinyInteger('status')->comment('开票状态 0 未开票 1 已开票');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('invoices');
    }
};
